package com.sskj.phoenixcoin.presenter;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import com.shizhefei.view.coolrefreshview.CoolRefreshView;
import com.sskj.common.base.HttpData;
import com.sskj.common.util.ToastUtil;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.phoenixcoin.activity.AppBindBankActivity;
import com.sskj.phoenixcoin.bean.AppBank;
import com.sskj.phoenixcoin.http.HttpConfig;


public class AppBindBankActivityPresenter extends BasePresenter<AppBindBankActivity> {
    public void getBank(String stockUserId, CoolRefreshView coolRefreshView) {
        OkGo.<HttpData<AppBank>>post(HttpConfig.BASE_URL + HttpConfig.GETBANK)
                .params("systemType", "ANDROID")
                .params("stockUserId", stockUserId)
                .tag(this)
                .execute(new JsonCallBack<HttpData<AppBank>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<AppBank>> response) {
                        if (coolRefreshView != null && coolRefreshView.isRefreshing()) {
                            coolRefreshView.setRefreshing(false);
                        }
                        HttpData body = response.body();
                        if (body.getStatus() == HttpConfig.OK) {
                            mView.successUi((AppBank) body.getData());
                        } else {
                            ToastUtil.showShort(body.getMsg());
                        }
                    }
                });
    }
}
